package com.yanqu.road.server.cmd.cross.config;

import com.yanqu.road.entity.enums.eSystemId;
import com.yanqu.road.pb.cross.group.CrossGroupProto;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.command.Command;
import com.yanqu.road.server.manger.SystemCrossServerGroupMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.manger.union.CrossUnionMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;
import io.netty.channel.ChannelHandlerContext;

@Cmd(code = Protocol.S_CROSS_SERVER_GROUP_RELOAD_NOTIFY_SYSTEM, desc = "系统-跨服来通知分组reload")
public class SystemServerGroupReloadNotifyCmd implements Command {

	@Override
	public void execute(ChannelHandlerContext ctx, YanQuMessage packet) throws Exception {
		CrossGroupProto.SystemServerGroupReloadNotifyMsg reqMsg = CrossGroupProto.SystemServerGroupReloadNotifyMsg.parseFrom(packet.getBytes());
		SystemCrossServerGroupMgr.reloadServerGroup(reqMsg.getSystemId());
		int systemId = reqMsg.getSystemId();
		if (systemId == eSystemId.Union.getValue()) {
			CrossUnionMgr.setAllSync(false);
		}
	}

}
